Skip to content

fix(cli): scope metadata db path to target repository#23

Merged
AperturePlus merged 1 commit intodevelopfrom
codex/fix-.aci/index.db-creation-path
Mar 14, 2026
Merged

fix(cli): scope metadata db path to target repository#23
AperturePlus merged 1 commit intodevelopfrom
codex/fix-.aci/index.db-creation-path

Conversation

@AperturePlus
Copy link
Copy Markdown
Owner

Motivation

  • Prevent .aci/index.db from being created relative to the caller's CWD when running aci index /path/to/repo, which caused aci search to report "Path has not been indexed" when the search was run from the project directory.

Description

  • Added a helper _project_metadata_db_path(path: Path) -> Path to derive the project-scoped metadata DB path as <repo>/.aci/index.db.
  • Updated get_services() to accept an optional metadata_db_path and forward it to create_services() so services initialize using the intended metadata file.
  • Wired CLI commands index, search (when given --path or implicit project), and update to call get_services(metadata_db_path=_project_metadata_db_path(...)), ensuring metadata operations are scoped to the target repository instead of CWD.
  • Design rationale: chose an explicit, minimal change to pass a project-scoped metadata path into service initialization for low-risk correctness; the alternative of falling back to the global registry was considered but would be a broader behavioral change and was deferred.

Testing

  • Ran linting with uv run ruff check src tests and it passed successfully (✅).
  • Executed targeted unit tests with uv run pytest tests/unit/test_cli.py tests/unit/test_cli_metadata_db_path.py -q and they passed (✅).
  • Ran full test suite with uv run pytest tests/ -v --tb=short -q --durations=10 but this run was interrupted after exposing pre-existing unrelated failures in the broader suite (⚠️); the failures are not caused by this change.
  • Ran type checks with uv run mypy src --ignore-missing-imports --no-error-summary which reported existing repository-wide typing issues unrelated to the CLI fix (⚠️).

Codex Task

Why: Index/search/update resolved .aci/index.db from CWD, which breaks cross-directory CLI usage and causes 'Path has not been indexed' errors.

What: Added a project-scoped metadata DB path helper and wired index/search/update to initialize services with <repo>/.aci/index.db instead of a CWD-relative default. Added unit tests to verify the scoped path behavior in CLI flows.

Test: uv run ruff check src tests (pass)

Test: uv run pytest tests/unit/test_cli.py tests/unit/test_cli_metadata_db_path.py -q (pass)

Test: uv run pytest tests/ -v --tb=short -q --durations=10 (interrupted; suite showed pre-existing failures while running)

Test: uv run mypy src --ignore-missing-imports --no-error-summary (fails with many pre-existing typing issues)
@AperturePlus AperturePlus merged commit 5f394be into develop Mar 14, 2026
1 check passed
@AperturePlus AperturePlus deleted the codex/fix-.aci/index.db-creation-path branch March 22, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant